using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_NewsAdmin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string js = "<script src=\"../nicEdit.js\" type=\"text/javascript\"></script>";
        js += "<script type=\"text/javascript\">";
        js += "bkLib.onDomLoaded(function() {";
        js += "new nicEditor({fullPanel : true}).panelInstance('" + TextBox1.ClientID + "');";
        js += "});";
        js += "</script>";

        ClientScript.RegisterStartupScript(Page.GetType(), "NicEdit", js);

        if (!IsPostBack)
        {
            TextBox1.Text = NewsAccess.GetNewsDetails().Description;
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string des = TextBox1.Text.ToString();

        bool success = NewsAccess.UpdateNews(des);

        statusLabel.Text = success ? "Aktualizacja udana" : "Aktualizacja nieudana";
    }

    
}
